A system and method for detecting a non-video source in video signals

ABSTRACT

A video sequence may include a modality corresponding with an embedded pattern. At least one state machine detects the modality in accordance with difference signals. A signal generator generates the difference signals responsive to decision windows that define regions of interest in the video sequence. The modality may correspond with an embedded film source or other pattern types in the video sequence. Where the state machine detects more than one pattern, a single pattern is selected according to a predetermined priority. The video sequence may contain both static patterns and embedded film source patterns. The state machine discerns the presence of the embedded film source patterns notwithstanding the presence of the static patterns.

This application is a continuation of U.S. pending patent applicationSer. No. 10/024,479 filed Dec. 21, 2001, and claims priority fromCanadian patent application No. 2,330,854 filed Jan. 11, 2001, both ofwhich we incorporate here by reference.

BACKGROUND OF THE INVENTION

The National Television Standards Committee (NTSC) was responsible fordeveloping a set of standard protocols for television broadcasttransmission and reception in the United States. A NTSC television orvideo signal was transmitted in a format called interlaced video. Thisformat is generated by sampling only half of the image scene and thentransmitting the sampled data, called a field, at a rate ofapproximately 60 Hertz. A field, therefore, can be either even or oddwhich refers to either the even lines or the odd lines of the imagescene. Therefore, NTSC video is transmitted at a rate of 30 frames persecond, wherein two successive fields compose a frame.

Motion picture film, however, is recorded at a rate of 24 frames persecond. It is often required that motion picture film is a source forthe 60 Hertz NTSC television. Therefore, a method has been developed forupsampling the motion picture film from 24 frames per second to 30frames per second, as required by the video signal.

Referring to FIG. 1, a scheme for upsampling the 24 frame per secondmotion picture film to the 30 frame per second video sequence isillustrated generally by numeral 100. A first 102, second 104, third106, and fourth 108 sequential frame of the film is represented havingboth odd 110 and even 112 lines. In order to convert the film frame rateto a video rate signal, each of the film frames are separated into oddand even fields. The first frame is separated into two fields 102 a and102 b. The first field 102 a comprises odd lines of frame 102, and thesecond field 102 b comprises even lines of the frame 102. The secondframe 104 is separated into three fields. The first field 104 acomprises the odd lines of second frame 104, the second fields 104 bcomprises the even lines of the second frame 104, and the third field104 c also comprises the odd lines of the second frame 104. Therefore,the third field 104 c of the second frame 104 contains redundantinformation.

Similarly, the third frame 106 is separated into a first field 106 acomprising the even lines and a second field 106 b comprising the oddlines. The fourth frame 108 is separated into three fields wherein thefirst field 108 a comprises the even lines of the fourth frame 108 andthe second field 108 b comprises the odd lines of the fourth frame 108.The third field 108 c comprises the even lines of the fourth frame 108and is, therefore redundant.

The pattern as described above is repeated for the remaining frames.Therefore, for every twenty-four frames there will be a total of 60fields as a result of the conversion, thus achieving the required videorate of 30 frames per second.

The insertion of the redundant data, however, can have an effect on thevisual quality of the image being displayed to a viewer. Therefore, inorder to improve the visual quality of the image, it is desirable todetect whether a 30 frame per second video signal is derived from a 24frames per second motion picture film source. This situation is referredto as a video signal containing an embedded film source. Detection ofthe motion picture film source allows the redundant data to be removedthereby retrieving the original 24 frames per second motion picturefilm. Subsequent operation such as scaling is performed on the originalimage once it is fully sampled. This often results in improved visualquality of images presented to a viewer.

The upsampling algorithm described above is commonly referred to as a3:2 conversion algorithm. An inverse 3:2 pull-down algorithm (hereinreferred to as the 3:2 algorithm) is the inverse of the conversionalgorithm. The 3:2 algorithm is used for detecting and recovering theoriginal 24 frames per second film transmission from the 30 frames persecond video sequence as described below.

It is common in the art to analyze the fields of the video signal asthey arrive. By analyzing the relationships between adjacent fields, aswell as alternating fields, it is possible to detect a pattern that willbe present only if the source of the video sequence is motion picturefilm. For example, different fields from the same image scene will havevery similar properties. Conversely, different fields from differentimage scenes will have significantly different properties. Therefore, bycomparing the features between the fields it is possible to detect anembedded film source. Once the film source is detected an algorithmcombines the original film fields by meshing them and ignores theredundant fields. Thus, the original film image is retrieved and thequality of the image is improved.

A similar process is achieved for PAL/SECAM conversions. PAL/SECAM videosequences operate at a frequency of 50 Hz, or 25 frames per second. A2:2 conversion algorithm, which is known in the art, is used forupsampling the film to PAL/SECAM video sequence rates. An inverse 2:2pull-down algorithm (herein referred to as the 2:2 algorithm) is usedfor retrieving original film frames in a fashion similar to thatdescribed for the 3:2 algorithm. PAL Telecine A and PAL T elecine B aretwo standard PAL upsampling techniques.

PAL Telecine A does not insert repeated fields into the sequence duringthe transfer from film frame rate to video frame rate. Thus, 24 framesbecome 48 fields after the Telecine A process. The result of having twofewer fields than the video rate is a 4% (2 fields missing out of therequired 50 fields) increase in the playback speed. In order to transferPAL Film to PAL Video without the 4% speedup, a process called TelecineB is used. Telecine B inserts a repeated field into the sequence every ½second (i.e. every 25^(th) field). Inclusion of a repeated fieldproduces a sequence that plays back without speedup for a 25 frames persecond video rate.

However, the film detection algorithms as described above are subject toproblems. Static objects such as subtitles and other icons may beinserted at a video rate after the film has been converted to video.These objects typically cause the film detection algorithm to fail sothat the series of contiguous image scenes, that is contiguous frames offilm, cannot be properly recovered. The result of these problems is thedisplay of original film images as though they were true video source.It is therefore, an object of the present invention to obviate ormitigate the above mentioned disadvantages and provide a system andmethod for improving the detection of film in a video sequence.

SUMMARY OF THE INVENTION

In accordance with an aspect of the present invention, there is provideda system and method for detecting a non-video source embedded in a videosequence and providing direction to a deinterlacing algorithmaccordingly. The system comprises a signal generator for generating aplurality of signals. The signals are generated in accordance withpixels input from the video sequence.

The system further comprises a plurality of pattern detection statemachines, each for receiving the signals and for detecting a pattern inthe video sequence. The pattern is detected in accordance with a presetthreshold, wherein the pattern detection state machine varies the presetthreshold in accordance with received signals.

The system further comprises an arbiter state machine coupled with theplurality of pattern detection state machines for governing the patterndetection state machines and for determining whether or not a non-videosource is embedded in the video sequence.

BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of the present invention will now be described by way ofexample only with reference to the following drawings in which:

FIG. 1 is a schematic diagram of a 3:2 frame conversation algorithm(prior art);

FIG. 2 is a block diagram of system for implementing a frame ratedetection and conversion algorithm;

FIG. 3 is schematic diagram illustrating a pixel window used foranalysis;

FIG. 4 is a block diagram of an alternating field signal generator;

FIG. 5 is a block diagram of an adjacent field signal generator;

FIG. 6 a is a schematic diagram illustrating how the nomenclature forpixel differences is defined;

FIG. 6 b is a schematic diagram illustrating a subset of structureddifferences for various edge types;

FIG. 6 c is a schematic diagram illustrating a subset of structureddifferences for various edge types;

FIG. 7 is a schematic diagram of a histogram generator;

FIG. 8 is a schematic diagram illustrating typical alternating fieldcomparisons for the 3:2 algorithm

FIG. 9 is a schematic drawing of a state machine for detecting thepattern illustrated in FIG. 8;

FIG. 10 is a schematic diagram illustrating alternating fieldcomparisons for highly correlated fields for the 3:2 algorithm;

FIG. 11 is a schematic diagram illustrating typical adjacent fieldcomparisons for the 3:2 algorithm;

FIG. 12 is a schematic diagram illustrating adjacent field comparisonsfor highly correlated fields of the 3:2 algorithm;

FIG. 13 is 3:2 state machine for analyzing adjacent field comparisons;

FIGS. 14-17 are schematic diagrams illustrating typical fieldcomparisons for the 2:2 algorithm;

FIG. 18 is a schematic diagram of a state machine for a 2:2 Telecine Aalgorithm;

FIG. 20 is a schematic diagram of a state machine for detectingsubtitles;

FIG. 21 is a schematic diagram of the hierarchical state machinearchitecture;

FIG. 22 is a schematic diagram of the signals generated for subtitledetection upon subtitle entry;

FIG. 23 is a schematic diagram of the signals generated for subtitledetection upon subtitle exit.

DETAIL DESCRIPTION OF THE PREFERRED EMBODIMENTS

A system is described for detecting whether a video signal, such asNTSC, or PAL or SECAM, contains an embedded film source. Each of thedifferent types of embedded sources within a video signal is referred toas a mode. The modality of the incoming video signal is determined andis subsequently used by a deinterlacing algorithm. The details of thedeinterlacing algorithm are beyond the scope of the present inventionand will be apparent to a person skilled in the art. Modality detectionand recognition are used for directing the deinterlacing strategy suchthat it maximizes the visual quality of the output image for aformat-conversion.

The system also implements pattern detection and analysis foridentifying other less traditional patterns that are characteristic ofcomputer video games. These different sources do not necessarily followthe 3:2 or 2:2 pattern. Therefore, the system is capable of implementingan N:M Autonomous State Machine that searches for repetitive patternsother than the 3:2 and the 2:2 patterns.

Patterns in an incoming video source are detected by a hierarchicalstate-machine structure. The hierarchical structure contains asupervisory component, or arbiter state machine, and several subordinatecomponents. For simplicity, each subordinate component is responsiblefor performing a pattern analysis and detection of a specific pattern.The subordinate components are implemented in the form of state machinesthat execute reconfigurable detection algorithms. These algorithms haveseveral input signals that are generated using various methods that willbe described in greater detail later in this description. The inputsignals are generated from the incoming video fields by examining theimage structure and content. The architecture is such that any new statemachine can be easily added in the existing framework. Therefore, anynew patterns that would be useful to detect and track can be includedand used for directing the deinterlacing algorithm.

The following embodiment details an enhanced pattern detection methodthat performs 3:2 and 2:2 detection for an embedded film source.Additionally, the embodiment details the workings of an algorithm thatis used to recognize less typical patterns that could be present in theincoming video signal. Accurate identification of the modality of theinterlaced input video can improve the image quality during formatconversion. An example of format conversion is altering an NTSCinterlaced source to a progressive output signal. The film modalityalgorithms are used for detecting and identifying the differencesbetween Video Mode Sources, NTSC Film Sources (3:2), and PAL/SECAM FilmSources (2:2).

The algorithm searches for specific patterns in the incoming videosignal that can be used to identify the modality of the video source.The algorithm further utilizes pattern detection for identifying regionsin the video source that may cause modality identification to falter,thereby achieving a more robust form of identification. These regionsinclude structural edges, objects inserted after filming (such as logosand subtitles), and the like.

The algorithm can be implemented entirely in hardware. Alternately, thealgorithm may be implemented as a combination of hardware and softwarecomponents. The latter implementation is preferred, as it is often moreflexible.

Referring to FIG. 2, a system for implementing the algorithm isillustrated generally by numeral 200. A signal generation block 202communicates with a software module 204 via a communication interface206. The software module 204 communicates, in turn, with avertical-temporal (VT) filter block 208 via the communication interface206.

The signal generation block 202 includes sections of the algorithm thatdirectly access pixel data. These sections include an Alternating FieldSignal Generator, and Adjacent Field Signal Generator, a HistogramGenerator, and a Subtitle Detector.

The software module 204 uses signals output from the generators listedabove for determining the mode of the source. It is anticipated for thepresent embodiment that the detection algorithms will be running on amicroprocessor such as an 80186. The algorithm determines and tracks thecorrect mode of the video sequence and instructs a de-interlacingalgorithm resident in the VT filter block 208 to apply the mostappropriate de-interlacing modes. The various VT de-interlacing modesinclude typical VT filtering (both common and proprietary methods) whichis applied if the modality of the video signal is True Video, CurrentField (CF) and Previous Field (PF) meshing, and PF and Previous PreviousField (PPF) meshing. The Previous Previous Field (PPF) is the fieldimmediately prior in time to the Previous field.

The following sections detail the hardware used for generating thevarious signals required by the 3:2/2:2 detection algorithm. Each sourcepixel is used only once during the generation of the signals renderingthe signal generation stage immutable to factors such as zooming as wellas other special signal processing functions.

A window consisting of a fixed number of columns and rows in the currentfield (CF), and a window consisting of another fixed number of columnsand rows I the previous field (PF) is available for use in 3:2/2:2detection. The windows are usually restricted in size to less than 5 by5 for the CF and 4 by 5 for the PF, and they are spatially interleaved.Together the grouping of CF pixels and PF pixels define a region ofinterest, or a decision window. It is in this window that many of theprimitive signals are generated for subsequent pattern analysis.

Referring to FIG. 3, the CF and PF windows are illustrated generally bynumerals 300. A naming convention for the CF and PF pixels is defined asfollows. A pixel in the Current Field in the ith row and the jth columnis denoted as CF(i,j). Pixels in the Previous Field are denoted in asimilar fashion as PF(i,j). For both naming conventions, let i denotethe vertical position and j denote the horizontal position in therespective field. The CF and PF are spatially offset vertically by oneline. Therefore, while CF(i,j) and PF(i,j) correspond to pixels thatbelong to the same column, they do not correspond the same verticalposition.

Signal Generation

Referring to FIG. 4, the Alternating Field Signal Generator isillustrated generally by numeral 400. A quantized motion value 402 isinput to a structured difference generator 404. The output of thegenerator 404, an enable signal is Valid, and a reset signal reset areinput to an accumulator 406.

The structured difference generator 404 computes a structured differencebetween pixels by accounting for structural information such as lines,edges, feathering and quantized motion. The structured difference is amore complicated method of generating field difference signals than asimple subtraction of pixel values. The structured difference iscontrolled by the rules and user-defined thresholds that are used fordeciding the types of image structures that are present. The structureddifference generator will be described in greater detail further on.

The accumulator 406 accumulates the quantized motion information for thepixels in a field and outputs a signal AltDiff once per field. Thesignal AltDiff is an indicator of change or relative spatial movementbetween the CF and the PPF. While such a change is not a true measure ofthe motion between alternating fields, it provides a measure of motionsufficient for the purposes of the algorithm. Throughout the remainderof the description, this change is referred to as motion.

The AltDiff signal is short for Alternating Difference. The AtlDiffsignal is generated on a field-by-field basis and is a difference signalthat is generated by accumulating those quantized motion differenceswhose magnitude exceeds a programmable threshold. The quantized motiondifferences are taken between two fields of the same polarity. That is,the difference is taken between two successive even fields or twosuccessive odd fields. Therefore, if the quantized motion difference issufficiently large, as measure against a programmable threshold, it willcontribute to the AltDiff signal. The AltDiff is set to 0 at thebeginning of each analysis.

The quantized motion information for each pixel is computed by taking adifference on a pixel-by-pixel basis. The difference is quantized to Nbits, by comparing the difference to a series of thresholds. The numberof thresholds defines a number of levels of motion. For example, ifthere are three thresholds, 0, 170, and 255, then there are two levelsof motion. If the difference falls between 0 and 170 it is considered tohave a first motion level. If the difference falls between 171 and 255it is considered to have a second motion level. Typically, there aregreater than two levels.

The number of bits required for storing the quantized motion informationdepends on the various levels of motion defined. In the presentembodiment, a programmable number of levels of motion are defined up toa maximum of 16, each level having a numerical value of 0 through 15.Therefore, four bits are required for storing the level of motion foreach pixel. The motion information is appended to the pixel data foreach pixel.

The levels of motion can be defined in more descriptive terms by the useof the labels. For example, depending on the level of motion, a pixelcan be considered to be STATIC, MOVING, MOVING FAST, MOVING VERY FAST,and so on, so that a sufficient number of levels are used to properlytreat the processed image.

An absolute difference is taken between the CF(i,j) pixel and the pixelPPF(i,j), where i and j refer to the ith row of the jth column in thesource image. In the present embodiment, the number of bits of pixelinformation is 8, and therefore, there can be a maximum difference of255 between pixels. Thresholds are determined for quantizing differenceranges so that for the levels of motion as described above have apredefined range. For example, a pixel that is considered static willhave a CF_((i,j))-PPF(i,j) difference in magnitude less than aprogrammable threshold, but is usually small (about 5). The range inwhich the inter-frame pixel difference falls corresponds to the level ofmotion for that pixel, and the four-bit quantized level of motioninformation is appended to the pixel information.

Referring once again to FIG. 4, if the enable signal isValid is high andthe motion information for the CF(i,j) pixel is greater than apredefined motion threshold, then the signal AltDiff is incremented.Therefore, the output signal AltDiff is a signal representative of thenumber of pixels in a neighborhood about the interpolated target pixelthat exceed a predefined motion threshold. The AltDiff signal is used bythe detection algorithm to assist in the identification of 3:2/2:2 andTrue Video modes.

The isValid signal allows algorithms that use pixel information to knowwhether the pixel information has already been examined for a specificpurpose. The isValid signal is encoded along with the pixel. One bit isused for this purpose. For example, during image interpolation where theimage is being scaled to a larger format, the same source pixels may beused multiple times to create the larger image. When generating controlsignals, such as a 3:2 detection signal, it is only desired to accountfor a pixel's contribution once. The isValid bit provides such controlto the pattern analysis algorithm.

Referring to FIG. 5, an Adjacent Field Signal Generator is illustratedgenerally by numeral 500. The signal generator 500 uses. Pixels in theCF window and pixels in the PF window are input into a structureddifference generator 502. The output of the structured differencegenerator 502, an enable signal isValid, a static indicator signalisStatic, and a reset signal reset are input to an accumulator 504. Theaccumulator 504 accumulates motion information for the pixels in a fieldand outputs a signal AdjDiff. The signal AdjDiff represents informationregarding the amount of motion between two adjacent fields, that is theCF and the PF. The purpose of AdjDiff signal accumulation is to obtain ameasure of the degree of inter-field motion for adjacent fields.

The AdjDiff signal is short for Adjacent Difference. The AdjDiff signalis generated on a field-by-field basis. It is the difference signal thatis generated by taking the structured difference between two fields ofdifferent polarity. That is, taking the structure difference between anadjacent even and odd field.

The accumulation of the AdjDiff signal is described as follows. TheAdjDiff signal is set to 0 at the beginning of each field, by activatingthe reset signal reset. The isMotion signal denotes which pixels shouldbe accumulated while the isStatic signal indicates which pixels shouldnot be accumulated (that is, which pixels are static). The accumulatoronly increments if there is motion (the isStatic signal is False). Thisimproves robustness of the AdjDiff signal by reducing its susceptibilityto structures such as edges.

However, certain structures, such as static edges may be misconstrued asinter-field motion using only pixel information in the CF and PF fields.Therefore, the accumulator 504 uses information relating to the staticnature of the pixel in a neighborhood about the target pixel fordetermining whether a particular source pixel in the region of interestis part of a static edge.

For instance, if it is determined that the pixel is part of a staticedge, then the static signal isStatic is asserted. Assertion of theisStatic signal prevents the pixel information from being accumulated bythe generator 500.

In addition, the accumulator 504 uses pixel information for determiningif motion structure exists. Motion structure occurs when a “feathering”artifact is present. The feathering artifact is a result of a structureundergoing relative motion in the CF and PF fields. Examining the CF andPF window information, and determining the number of pixels that exhibitpotential feathering, is deemed under many conditions to be a reasonablyreliable indicator of whether two fields originated from the same ordifferent image frames. The exception for this is static. Therefore,static information is also given some weighting in the decision process.The motion structure calculation determines whether a featheringartifact exists between the CF and PF Windows. If motion is present, themotion signal isMotion is affirmed. This calculation is based on anexamination of the column coincident with the column of the targetpixel.

Referring to FIG. 6 a, an array of pixels is illustrated generally bynumeral 600. A naming convention is defined as follows. Similarly toFIG. 3, current field pixels are referred to as CF(i,j) and previousfield pixels are referred to as PF(i,j). Differences between CurrentField pixels are referred to as CFCFa for the difference between pixelsCF(a-1,y) and CF(a,y). Differences between Previous Field pixels arereferred to as PFPFb for the difference between pixels PF(b-1,y) andPF(b,y). Differences between Current Field pixels and Previous fieldpixels are referred to as CFPF1 for the difference between pixelsCF(0,1) and PF(0,1), CFPF2 for the difference between pixels CF(1,1) andPF(0,1), CFPF3 for the difference between pixels CF(1,1) and PF(1,1) andso on.

For motion structure calculation, source pixels in the CF, specificallytwo pixels immediately above and two pixels immediately below the targetpixel position are compared with the corresponding pixels in the PF. Thelevel of motion is determined in the region of interest in accordancewith the comparisons. For the purposes of the description, it is assumedthat two pixels in each of the CF and PF are compared. For example,CF(1,1) is compared with PF(1,1, CF(2,1) is compared with PF(1,1), andCF(2,1) is compared with PF(2,1). If the absolute value of thedifference of each comparison is greater than a predetermined thresholdand either

i) all the CF pixel values are greater than the PF values; or

ii) all the PF pixels values are greater than the CF values,

then motion is deemed present in the region of interest. The thresholdsare, in general, programmable, but typically take on a value ofapproximately 15. The value may vary depending on the level ofanticipated noise in the image scene.

Alternately, CF(1,1) is compared with PF(0,1), CF(1,1) is compared withPF(1,1), and CF(2,1) is compared with PF(1,1). If the absolute value ofthe difference of each comparison is greater than a predeterminedthreshold and either all of the CF pixel values in the region ofinterest are greater than the PF pixel values or vice versa, then motionis present in the image.

FIG. 6 c represents some of the structured difference patterns that areassociated with a feathering artifact in interlaced sources. It shouldbe noted that feathering is a necessary, but not sufficient conditionfor inter-field motion to be present. That is, feathering is a strongindicator that inter-field motion might be present. By detectingfeathering using the method described above, and further correlatingthis information with persistence information associated with eachpixel, it is possible to get a good indication as to whether the CF andPF fields are undergoing relative motion. That is, whether the trueinterlaced feathering artifact is present in the region of interest.

Referring to FIGS. 6 a and 6 b, the structured difference generator isdescribed in greater detail. The structured difference calculations usequantities such as CFCF1, CFPF2 and so on, for providing Booleaninformation to indicate whether a specific structure difference, orstructured edge type, is present in the region of interest.

In FIGS. 6 b and 6 c, light and dark pixels in the diagrams indicate astructural difference of note between pixel intensities on a per channelbasis. The patterns illustrated in FIG. 6 b are a partial enumeration ofsome of the various structural edge patterns that can be detected. Aspecific pattern is detected based on the combination of the differencecomputed in FIG. 6 a. The pixels marked by an “x” indicate “don't care”pixels. For example, Edge Type III-A corresponds to the followingcondition being satisfied:Edge Type III-A=Abs(CFCF1)<T1 AND Abs(CFPF1)<T1 AND Abs(CFPF2)<T1AND Abs(CFCF2)>T2 AND Abs(PFPF1)>T2 AND Abs(CFPF4)<T1AND Abs(CFPF3)>T2

Therefore, Edge Type III-A is present if the above boolean statementevaluates to true. The thresholds T1 and T2 are programmable. Booleanstatements for the other structured edge types can be similarlydetermined.

Once a specific edge type is asserted, other conditions are applied tofurther qualify the nature of the behavior of the pixels in the regionof interest. These further conditions test the specific edge type forspecific structured motion difference information that is associatedwith each pixel. The subsequent information is used to help determinewhether the specific pattern has persisted across many successivefields. Should it be determined that the specific pattern has persistedfor eight fields, for example, the determination that the pixel patternis a true part of a stationary (static) portion of the image scenebecomes more clear. If it is deemed part of a structural edge, and notpart of a feathering artifact, then the contribution to either theAltDiff or the AdjDiff signals is muted.

The subsequent persistence check is required to exclude the possiblepresence of fine detail in the CF and PF fields. A static fieldcontaining black in the CF and white in the PF will appear gray to theviewer. Had the AdjDiff and AltDiff signals been driven only by afeathering detector, then the presence of static fine detail wouldcontaminate the clarity of these signals. It is thus an improvement tobe able to correlate structured motion information with the structureddifference information when computing AdjDiff and AltDiff.

Referring to FIG. 7, a Histogram Generator is illustrated generally bythe numeral 700. The histogram generator 700 has an enable signalisValid, the CF(0,1) pixel, and reset signal RESET as its input. Thegenerator outputs a boolean scene signal isSameScene, which isrepresentative of the distribution of the luminance data content for agiven field.

It is assumed that each source pixel is used once. The enable signalisValid prevents a source pixel from contributing to the histogram morethan once, which is a possibility where the source image is beingzoomed.

The scene signal isSameScene indicates whether the CF and PF are part ofthe same image scene. A scene change causes the isSameScene signal to befalse. Fields originating from the same image can originate from thesame frame of film, or sequence of frames (for example, a sunset). Ascene change occurs when two different image scenes are spliced together(for example, a tennis game followed immediately by a sequence of aspace shuttle orbit).

If a scene change occurs, it is possible that the pattern detected bythe 3:2/2:2 algorithm has been interrupted. Therefore, if a change inscene is detected, this information is used to modify the thresholds inthe state machine. That is, the algorithm makes the thresholds fordetecting the 3:2/2:2 pattern less strict than if the scene is deemed tobe the same. Conversely, the thresholds are made stricter if the sceneis deemed to have changed. In this way corroborative information is usedto help maintain the current operation mode, either 3:2/2:2 or someother mode defined in software. This also helps to prevent modeswitching. Mode switching can be visually displeasing and occurs whenthe Arbiter State Machine decides to drop out of or fall into aparticular processing mode.

Alternately, if it is determined that the source has switched (forexample, advertisements at a video rate inserted between the tennismatch and the space shuttle in orbit), the algorithm adjustsaccordingly.

Scene changes can be detected by examining the histogram of the Y (orLuminance) channel. If two adjacent fields originated from the samescene, their histograms will be closely correlated. It is rare for twofields from different scenes to exhibit similar histograms.

In the present embodiment, 8 bins are used for histogram generation,although it will be apparent to a person skilled in the art that thenumber of bins is arbitrary. Each bin, therefore, represents ⅛^(th) ofthe Y channel. A 21-bit accumulator (assuming the maximum imageresolution is 1920×1080) is required. Therefore, the 8 bins eachcomprise a register of 21 bits in size are required for storing theprevious field histogram. The CF histogram is compared with the PFhistogram.

The eight registers used for the current field histogram are referred toas currHist[0] through currHist[7]. Similarly, the eight registers usedfor the previous field histogram are referred to as prevHist[0] throughprevHist[7]. In general, the bins will not be of equal width, sinceluminance data does not always use the full 8-bit dynamic range. Forexample, the Y (luminance) signal ranges from 16-235 (inclusive) in theYCrCb color space. In general, the levels used by a channel in a givencolor space are programmable. Since 8 does not divide evenly into 220,the last bins, currHist[7] and prevHist[7], have a smaller range (width)than the rest. The registers are set to 0 at the beginning of eachfield, by activating the reset signal reset.

If the isValid signal indicates that the pixel has not yet contributedto the histogram then its luminance value is examined. The generation ofthe histogram information is performed as follows. Let R(k)=[L(k),U(k)]be a set that defines a range between a lower threshold L(k) and anupper threshold U(k) such that L(k)≦U(k)=L(k+1) for k=0 through 6, whereU(7) is usually set to 255 where the last upper boundary is included.Then as Y falls into R(k), currHist[k] is incremented. The values ofL(k) and U(k) are programmable.

The scene signal isSameScene is calculated by comparing the histogramassociated with the Previous Field with the histogram associated withthe Current Field. The scene signal isSameScene is a boolean value forrepresenting either a scene change or no scene change. There are manypossible methods for generating the isSameScene signal and it can, ingeneral, be a composite of many conditions, which together, are used togenerate the isSameScene signal.

One condition used in the generation of the isSameScene signal takes thedifference between the corresponding bins of the currhist[i] and theprevHist[i] for I=7. If any of these differences exceed a predeterminedprogrammable threshold, the condition is true. Prior to subtraction, thecurrHist[i] and the preHist[i] information may be quantized using aprogrammable right-barrel shifter. Shifting a positive binary number tothe right divides the number by two, thereby making it smaller. Thisfunction naturally quantizes the number by using only the desired numberof most significant bits.

A secondary condition used in the generation of the isSameScene signalaccumulates the absolute differences between the currHist[i] and theprevHist[i] for all. If the sum of the absolute differences, referred toas histSum, exceeds a threshold, the second condition is affirmed. Thethreshold is programmable. For many applications, an 11 bit lengthregister is sufficiently large to store the histSum value. This sizeallows for a count value up to 2047. Any value exceeding this countshould be clamped. The isSceneChange signal is affirmed if either one ofthe aforementioned conditions is met.

The values exemplified above are not atypical because they could be usedto represent the maximum specific resolution of High DefinitionTelevision (HDTV), known as 1080 i. These values may increase insubsequent years so programmable length registers are used toaccommodate future formats.

Referring to FIG. 20, a Subtitle Detection State Machine is illustrated.The Subtitle Detection State Machine uses a number of differentcalculations to determine whether a row is part of a subtitle. Thecalculations look for temporal and spatial edges within an image.

The subtitle detection state machine outputs a subtitle signalisSubtitle for indicating whether a subtitle is detected in the sourceimage. This information is useful once in the 3:2/2:2 mode. For a videosequence, the signal isSubtitle can be affirmed frequently, but is notalways significant. The signal isSubtitle is significant when in the3:2/2:2 mode and when the correlation of adjacent fields is expected tobe Low, an indication that they originated from the same frame of film.

Subtitles in film are often included at video rates and are not part ofthe original film source. Subtitles are relatively static because theymust be displayed long enough for a viewer to read them. However, theinsertion of subtitles at video rates may confuse the 3:2 State Machinepossibly leading it to mistakenly conclude that a source video signal isa True Video sequence when it is actually an embedded film source. Bydetecting subtitles, the 3:2/2:2 State Machines become more resilient tothe inclusion of video rate subtitles that force the tracking algorithmsto reject the presence of both the 3:2 and 2:2 modes.

To determine whether a subtitle exists within a field, a Subtitle StateDetection Machine is fed pixel value information from the current andprevious fields on a row-by-row basis. The pixel information is used todetermine whether a row is part of a subtitle. If a predefined number ofconsecutive rows indicate the existence of a subtitle, the field isconsidered subtitled, and the signal isSubtitle is set High. Otherwise,the signal remains Low.

The state machine searches for a row of pixel-values that exhibitcertain wave-like properties. The wave-like properties are typically ahigh frequency sequence of alternatively high and low pixel values. Sucha sequence could well be indicative of text of the subtitle. It is veryunlikely that such a sequence will exist in a field in the absence of asubtitle. Therefore, if the number of high-low sequences in a given rowexceeds a predefined threshold, and the pattern is repeated for apredefined number of successive rows, it is determined that a subtitleis present in the video signal. Furthermore, by recording the beginningand ending point of the high-low sequence, and the corresponding clusterof rows, it is possible to specify the region in the image scene that isoccupied by the subtitle.

In addition to the wave signal, the inter-frame differences (quantizedmotion information) is also used for determining whether a number ofsuccessive pixels are static. This helps the decision making process andmakes the subtitle detector more robust.

The Subtitle Detection State Machine is composed of two smaller embeddeddetection state machines, each of which runs in tandem. The embeddedstate machines exploit the fact that a subtitle must first appear(subtitle entry) in one field and then disappear (subtitle exit) anumber of fields later. Typically, a subtitle appears first in the CFand then in the PF. The subtitle first leaves the CF and then leaves thePF. One way to capture this behavior is to run a CF Subtitle DetectionState Machine that detects the subtitle entry in the CF and a PFSubtitle Detection State Machine that is used to detect subtitle exit inthe PF. This represents one of many possible approaches to implementingstate machines for detecting subtitles. Many other functionally similarincantations are possible as will be appreciated by a person skilled inthe art. The operation of the subtitle detection state machine isdescribed in detail further on in this description.

Software Module

The software module comprises a data memory block (for storing a historyof data), and a series of state machines that are used for the purposesof pattern analysis and recognition. Referring to FIG. 21, a hierarchyof state machines is represented generally by numeral 2100. An arbiterstate machine 2102 governs a plurality of subordinate state machines.These subordinate state machines include pattern specific statemachines, such as a 3:2 state machine 2104, a 2:2 state machine 2106, aN:M state machine 2108, and other state machine reserved for futurealgorithms 2110.

The 3:2 state machine 2104 executes a software based reconfigurablepattern detection and analysis algorithm that serves to discern whetherthe underlying video signal contains a 3:2 pattern. The 2:2 statemachine 2106 executes a software based reconfigurable pattern detectionand analysis algorithm which serves to discern whether the underlyingvideo signal contains a 2:2 pattern. The N:M state machine 2108 executesa software-reconfigurable pattern detection and analysis algorithm whichserves to discern whether the underlying video signal contains a N:Mpattern.

All subordinate state machines run concurrently. Furthermore, thesubordinate state machines may have their own subordinate statemachines. For example, a Telecine A state machine 2112 and a Telecine Bstate machine 2114 are subordinate to the 2:2 state machine 2106.

The Arbiter State Machine

The arbiter state machine is used for resolving conflicts or ambiguitiesbetween lower level state machines. For example, suppose the 3:2 statemachine and the 2:2 state machine each indicate that the underlyingvideo signal contains a 3:2 and a 2:2 pattern respectively, at the sametime. Both state machines cannot be correct because a video signalcannot contain both a 3:2 source and a 2:2 source simultaneously. Inthis respect the presence of the two patterns at the receiver ismutually exclusive. In the event that the 3:2 signal is active and the2:2 signal is active, the arbiter state machine determines how to directthe deinterlacing algorithm. One outcome may have the arbiter statemachine direct the deinterlacing algorithm to treat the incoming videosignal as true video.

Thus, the arbiter state machine allows only one possible outcome. Eitherthe signal will indicate the presence of 3:2, 2:2 or N:M, or none ofthem, but never two at the same time. The arbiter state machine containsrules of precedence that aim to resolve any conflicts that arise duringsignal detection by subordinate state machines. Within each of thesubordinate state machines there are smaller logic components that serveas connective logic. Each of the subordinate state machines uses theprimitive pattern analysis signals isSameScene, isSubtitle, AltDiff, andAdjDiff.

The AltDiff and AdjDiff signals are stored in the data update block. Thefive most recent values are stored for each signal. Storage for thesesignals is usually implemented in the form of a circular queue becauseit is a convenient way to track signal history. For example, thecircular queues can be implemented as two arrays of 32-bit integers. Themost recent data is kept at the head of the queue, and the oldest datais stored towards the tail.

The ten most recent isSameScene values are stored in the data updateblock. This is currently implemented using a circular queue containingsufficient storage for ten Boolean values.

The five most recent isSubtitle values are stored in the data updateblock. This is currently implemented using a circular queue containingsufficient storage for five Boolean values.

The 3:2 State Machine

The 3:2 state machine is used to help determine whether to switch into3:2 processing mode or whether to remain in (or switch back into) truevideo mode. However, the final decision whether 3:2 based deinterlacingwill take place resides with the arbiter state machine. The 3:2 statemachine makes use of the generated signal information, along with theisSameScene and isSubtitle information to help decide when to changestate. State changes not only determine whether a 3:2 pattern ispresent, but also identify the location of the video signal in the 3:2pattern. The state machine can be implemented in hardware or software,the latter being more flexible.

The input data mode, as determined from the input video signal, can beobtained by analyzing a time-based pattern of the AltDiff and AdjDiffsignals. In NTSC Video, odd and even fields of a frame are captured oneafter another and have an inter-field latency of 1/60^(th) of a second.As a consequence, there may be little or no correlation between adjacentfields in high motion sequences due to the fact that the image contentof the image scene is rapidly evolving.

In NTSC Film (3:2), fields of the same frame are based on the same imagescene and so are captured at the same moment in time. Thus, there isusually some, and possibly a considerable degree, of correlation betweenthe odd and even fields that originate from the same frame of film. Thisis true for both in high and low motion sequences, including sequencesthat are static. In relative terms, the fields of a 3:2 image sequencethat do not originate from the same frame of film are likely to be lesscorrelated in high motion sequences, but may continue to be highlycorrelated for a low motion sequence.

The AltDiff signal is generated using data from the Current Field andthe Previous Previous Field. This signal is used to identify therepeated field characteristic of NTSC Film Mode. For typical NTSC Filmsequence, the signal generated by the AltDiff signal will have a 5-cyclepattern, consisting of 4 High signals and 1 Low signal. This pattern isthe result of the repeated field that occurs every 5^(th) field. FIG. 8illustrates the expected AltDiff signal pattern for NTSC Film (3:2).

A state machine, illustrated in FIG. 9, looks for the characteristic dipin the AltDiff signal. This dip is needed for the 3:2 State Machine toinitialize 3:2 mode. Thereafter, the 3:2 State Machine attempts to trackthe incoming video signal for the 3:2 sequence.

Some of the idiosyncratic behaviors of tracking 3:2 mode are engenderedinto the 3:2 State Machine. For instance, there is little or nocorrelation between every other field in NTSC Video mode with highmotion. Thus, the AltDiff signal will fluctuate but remain at arelatively high level. There will not be a large dip in the AltDiffsequence as would have been the case had the incoming video signalcontained embedded NTSC film FIG. 10 illustrates the expected AltDiffsignal pattern for NTSC Video.

The AdjDiff is generated using Current Field data and Previous Fielddata. The AdjDiff signal is used to identify the pattern that is aresult of the repeated field characteristic found within NTSC Film (3:2)Mode. Odd and even fields originating from the same image scene willlikely exhibit a significant degree of inter-field correlation. Thiswill result in an expected low AdjDiff signal.

However, odd and even fields originating from different image scenes(i.e. different frames of film, had the video signal contained embeddedfilm) may or may not be correlated, depending on whether the inter-fieldmotion within the sequence is low or high. For a high motion sequence,the structured difference between the odd and even fields will result ina high signal, or low correlation. For a low motion sequence, the signalwill be low, or high correlation.

In a high motion sequence, the AdjDiff signal maintains a 5-cyclepattern: High-Low-High-Low- Low as is illustrated in FIG. 11. For a lowmotion sequence, the AdjDiff signal may degrade to a relatively flatsignal (having little variation) as illustrated in FIG. 12. FIG. 13illustrates the basic 3:2 state machine for the AdjDiff signals.

Once the 3:2 state machine has concluded that the 3:2 pattern ispresent, it signals the arbiter state machine to that effect.Thereafter, barring contention brought about by the affirmation ofanother mode detected by another subordinate state machine, the 3:2 modewill predominate until such time as the 3:2 State Machine determinesthat the signal is no longer present. The 3:2 State Machine searches forthe characteristic High-Low-High-Low-Low-High-Low-High-Low-Low-High- . .. pattern in the AdjDiff signal and the characteristicHigh-High-High-High-Low . . . pattern in the AltDiff signal.

The 3:2 state machine is aware of the fact that a video sequencecontaining high motion can also become a video sequence in which themotion is low, and vice versa. Numerous conditions are weighed by the3:2 state machine to help it transition through its internal states inan intelligent and robust manner to aid in continued detection of the3:2 mode. These conditions include:

1. Normal Motion conditions

2. Low Motion Conditions during the Same Scene

3. Low Motion Conditions during a Scene Change

4. Subtitles Detected (On Display/On Exit) and Same Scene

5. Subtitle Detected (On Display/On Exit) and Scene Change

6. One-time turn-over Conditions

These are some of the states used by the 3:2 state machine. During eachstate, a specific pattern of the AltDiff and AdjDiff signals isexpected. It is, nevertheless, quite possible that video sequences thatcontain low motion sequences or contain subtitles, or other data (suchas special effects or the like) that may not satisfy hard conditions forcontinued tracking of the anticipated 3:2 pattern. It is undesirable toexit 3:2 mode prematurely due only to low motion sequence or the onsetand continued presence of subtitles. Therefore, special conditions arein place within the 3:2 algorithm to watch for and guard against sucheventualities.

For low motion scenarios, the isSameScene signal can be used to helpgauge whether the anticipated pattern is still effectively present. Thatis, if the scene is deemed not to have changed, a more relaxed thresholdmay be used to track the anticipated 3:2 pattern.

For subtitle entry and subtitle exit, the isSubtitle signal is used toindicate whether a subtitle was detected within the video signal.Therefore, if a subtitle is detected in the video sequence, then therules for detecting a 3:2 pattern are relaxed. For example, a lowAdjDiff signal is expected at a particular point within the sequence,but a High AdjDiff signal is present instead. If the isSubtitle is High,the 3:2 state machine becomes more lenient, allowing for more departuresfrom the strict interpretation of the 3:2 pattern. Therefore, the 3:2state machine makes allowance for one-time turnovers, which allow asingle bad signal to occur without losing the 3:2 pattern.

The 2:2 State Machine

The 2:2 state machine is used to help determine whether to remain in (orswitch back into) true video mode. The arbiter state machine makes thefinal decision. The 2:2 state machine makes use of the AltDiff andAdjDiff signals, along with the isSameScene and isSubtitle informationto move between the various states.

The input data mode is determined by analyzing the pattern of theAltDiff and AdjDiff signals. In PAL Video, odd and even fields of animage scene are capture independently. Thus, there is likely to belittle or no correlation between adjacent fields in high motionsequences. In PAL Film (2:2), fields of the same frame of film arecaptured at the same moment in time. Thus, there is some correlationbetween odd and even fields coming from the same frame in both high andlow motion sequences. Fields of 2:2 sequences that do not come from thesame frame will have relatively less correlation in high motionsequences, but may continue to be highly correlated for a low motionsequence.

The AltDiff signal is generated using data from the Current Field andthe Previous Previous Field. This signal is used to identify therepeated field characteristic of PAL (2:2) Telecine B Film Mode. ForTelecine B 2:2 sequences, the signal generated by the AltDiff signalwill have a 25-cycle pattern, consisting of 24 High signals and 1 Lowsignal. This pattern is the result of the repeated field that occursevery 25 cycles. FIG. 14 illustrates the expected AltDiff signal patternfor PAL (2:2) Telecine B Film. In Telecine A type PAL Film sequences,there is no useful pattern resulting from the AltDiff signal.

The AdjDiff signal is generated using data from the Current Field andthe Previous Field. This signal is used to identify the pattern that isfound within PAL Film (2:2) Mode. As stated earlier, odd and even fieldsoriginating from the same frame will be correlated, resulting in anexpected low signal.

Odd and even fields originating from different image frames of film, mayor may not be correlated, depending on whether the motion within thesequence is low or high. For a high motion sequence, the calculationbetween the odd and the even fields will result in a high signal, or lowcorrelation. For a low motion sequence, the signal will be low, or highcorrelation.

In a high motion sequence, the AdjDiff signal for Telecine A maintains arepetitive 2-cycle pattern: High-Low), as illustrated in FIG. 15. For alow motion sequence, the AdjDiff signal may degrade to a relatively“flat” signal, as illustrated in FIG. 16. In a high motion sequence, theAdjDiff signal for Telecine B exhibits a 25-cycle pattern:High-Low-High-Low- . . . -High-Low-Low, as illustrated in FIG. 17.Similarly for Telecine B, the signal may degrade for Low Motionsequences.

Both the 3:2 state machines and the 2:2 state machine use the AltDiffand the AdjDiff signals internally. However, these state machines can beseparated into sub-components. One sub-component is responsible fordetection of pertinent patterns in the AltDiff singal and a secondsub-component is responsible for the detection of pertinent patterns inthe AdjDiff signal.

The AltDiff signal is used for detecting Telecine B pattern. If a “dip”is found in the AltDiff signal, a counter is initialized and incrementedon each successive field to track the 24 fields that must be observedprior to an anticipated dip in the AltDiff signal. The 2:2 state machineuses this information to track the low signal that is expected on every25^(th) field.

Referring to FIG. 18, the state machine for the 2:2 Telecine A Mode isillustrated. Telecine A usually requires several High-Low transitionsprior to affirming that the input video signal exhibits thecharacteristic 2:2 pattern. A longer lead-time is required for 2:2pattern detection because switching into 2:2 processing mode when theinput video stream is not truly 2:2 can result in deinterlacingartifacts. Therefore, it is preferable that a high degree of certaintybe attained that the underlying sequence is a 2:2 sequence prior toentering the 2:2 processing mode. Some of the conditions currentlyincluded in the algorithm are:

-   -   1. Normal Motion    -   2. Normal Motion, Same Scene    -   3. Low Motion, Same Scene    -   4. Subtitle Detected, Same Scene    -   5. Subtitle Detected, Scene Change    -   6. One-time Turnover    -   7. Low Cases—Telecine B only

The following describes the workings of the 2:2 state machine. Themethodology used in the 2:2 state machine is similar to that of the 3:2state machine.

There are a number of internal states in the 2:2 state machine. Muchlike the 3:2 state machine, low motion sequences, subtitles, or otherdata (such as special effects, etc.) may not satisfy hard conditionsthat need to be met in order to deem that a 2:2 pattern is present.Therefore, as with the 3:2 state machine, the thresholds are relaxed ifthe isSameScene signal or the isSubtitle signal is asserted.

One departure from the 3:2 state machine is that the 2:2 state machinemust detect and track two versions of the 2:2 pattern. These patternsare used internationally and are called Telecine A and Telecine B.Telecine A is usually the easier of the two to detect. Telecine B ismore complicated, and requires an additional counter and a separatestate to detect reliably. The counter is used to measure the anticipatedseparation between “repeated fields.” The “special” state in the 2:2state machine detects the repeated field condition and expects a LowAltDiff signal. This algorithm is subject to all of the specialconditions mentioned previously, such as low motion, subtitles, and thelike.

The N:M State Machine

It should be noted that depending on a pulldown strategy used, theAltDiff and AdjDiff signals have different patterns. The pulldownstrategy is one in which fields are drawn from an image scene. In 3:2pulldown, 3 fields are drawn from the same image scene. For the nextimage scene only two fields are drawn. Hence, the name 3:2 pulldown. Inthe general case, N fields can be drawn from one image scene and Mfields can be drawn from the next image scene. Hence the term N:Mpulldown.

There are some conditions that can be used to guide in the detection ofthe pulldown strategy. It is not always true that for all N:M pulldownstrategies, that both AltDiff and AdjDiff will have periodic patterns.For example, if AltDiff is High for all time, then no more than twoadjacent fields are drawn from the same image scene at a given time t.If AdjDiff is High for all time, then no more than one field is drawnform the same image scene at a given time t. Further, the image scenehas changed when both AdjDiff and AltDiff are High. Based on theseconditions, and the emergence of a pattern in either the AltDiff orAdjDiff signals, fields that were drawn from the same image scene areidentified. Therefore, redundant field information is ignored and eitherthe CF and PF are meshed or the PF and PPF are meshed in order torecover the image scene.

The N:M state machine searches for repetitive patterns in the inputvideo signal to determine its modality. Once a pattern has beendetected, this information can then be used to deinterface the fields ofthe incoming video signal in such a way the artifacts caused byinterlacing are effectively removed.

The general idea behind the N:M state machine is to determine whichfields need to be meshed together to recover the fields that originatedfrom the same image scene and to ignore redundant fields. Once this isaccomplished, subsequent operations such as scaling and noise reductionare performed on a fully sampled image. These operations will yieldimages that are visually superior in detail and sharpness compared toimages operated on without performing the N:M detection.

The algorithm that is executed in the N:M Autonomous State Machineincludes two Autocorrelation Engines and two Pattern Following StateMachines. One Autocorrelation Engine (AE) examines the AltDiff signaland another examines the AdjDiff signal for patterns. Each AE performsthe following mathematical operation for a given input signal v:Corr(i)=Σ(v(j)

v(j−i)) for all j in v.

The operator

that is most commonly used is multiplication, but other operations arealso possible such as an exclusive NOR (XNOR). The XNOR is a logicaloperation that has a false (0) output when the inputs are different anda true (1) output when the inputs are the same.

The function Corr(i) will exhibit periodic behavior as the variable v(j)exhibits periodic behavior. Moreover, it is possible to discern theperiod of the signal v by examining the distance between two or morepeak values in the Corr signal having equal amplitudes. In particular,if the XNOR correlation operator is used, the peak value shouldcorrespond exactly to the distance between peaks. Once two or morerelevant peaks have been detected, a periodic N:M pattern has beenfound. The exact number of peaks required to define a pattern isgoverned by a programmable threshold. Once the pattern has been found inthe v signal, the N:M Autonomous State Machine exacts the repeatingportion of the v signal. This portion corresponds to the portion of thev signal that lies between peaks including the v signal value that isaligned with the peak.

That is, given that there are peaks at Corr(k) and Corr(k+d), the repeatportion of the v signal is given by the sequence (v(k+1),v(k+2), . . .v(k+d)) which is denoted as P. At this point pattern lock is achievedand the arbiter state machine is notified. The pattern P is then loadedinto a Pattern Following State Machine. This state machine has theanticipated pattern on a field-by-field basis. It is initialized withthe correct starting point, which is determined by the distance from themost recent relevant peak in Corr to the most recent field subsequent tothis peak. The Pattern Following State Machine compares the incoming vsignal to the anticipated signal P. As long as there is correspondencebetween these two signals a pattern lock is maintained.

If the pattern lock is lost due to a lack of agreement between the twosignals, this information is communicated to the arbiter state machine.The arbiter state machine takes the necessary action. As describedbefore, should subordinate state machines detect signals andsimultaneously notify the arbiter state machine, the arbiter statemachine uses conflict resolution rules and rules of precedence todetermine a course of action. For instance, should the 3:2 state machineand the N:M state machine both indicate that a 3:2 pattern is presentthis serves to reinforce the belief that the 3:2 pattern is present, butpriority could be given to the 3:2 state machine.

Subtitle State Machine

The subtitle state machine detects subtitles that have been insertedinto the video signal at video rates. The subtitle state machineprovides another input into the modality detection state machines. Theoperation of the subtitle state machine is described as follows.

Referring to FIG. 22, the word “TEXT” has been inserted to a videosequence as a subtitle. Initially the subtitle is not part of the imagescene as indicated by its absence in the CF at the time t-1. As thepixels are examined row by row in the CF, signals corresponding to boththe spatial edge and the temporal edge are generated. The first set ofsignals for rows 1, 2 and 3 show the Spatial Edge Information for the CFat time t-1. Note that for convenience we also refer to the CF at timet-1 as the PF at time t. The corresponding signals are flat, indicatingthat no edges are present in those rows in the PF.

The subtitle first appears in the CF at time t. The correspondingspatial and temporal edge signals are generated. The spatial edgeinformation (CF) shows how the spatial edge detector generates a signalbased on the magnitude of the difference between spatially adjacentCF(i,j) and PF(i,j) pixels as we move across rows 1, 2 and 3. At thesame time, a temporal edge detector generates a signal by examining thetemporal edge. That is, a pixel-by-pixel magnitude of the differenceCF(i,j)-PPF(i,j).

FIG. 23 illustrates the situation upon subtitle exit. The subtitle“TEXT” is present in the PF, but is not longer in the CF. Thecorresponding spatial edge signals and temporal edge signals are shown.

The spatial edge signal and the temporal edge signals are fed as inputsinto the subtitle detector state machine. The state machine looks forsuccessive pulses of sufficiently high frequency in the spatial edgesignal and the temporal edge signal. If a succession of adjacent rowshave a sufficient number of such transitions then the region is deemedto include a subtitle. This information is communicated to the 3:2, 2:2,N:M, and other state machines that require it as input. Many courses ofaction are possible upon determination of a subtitle, but one examplewould be to loosen the threshold requirements for 3:2 mode retentionshould 3:2 mode already have been detected.

Deinterlacing

The deinterlacing algorithm takes input from the state machines thatdetect and track the various video modes. If the state machines havedetected that the source of the video sequence is film, then theappropriate redundant fields are ignored and the fields are meshedtogether. However, if it is determined that the source of the videosequence is video, then each field is de-interlaced in accordance withthe appropriate technique being implemented by the de-interlacingalgorithm. Such techniques include both public and proprietarytechniques, as will be apparent to a person skilled in the art.

Although the invention has been described with reference to certainspecific embodiments, various modifications thereof will be apparent tothose skilled in the art without departing from the spirit and scope ofthe invention as outlined in the claims appended hereto.

1. A system comprising: a video sequence; at least one decision window, each window defining a region of interest in the video sequence; a signal generator to generate first and second difference signals responsive to the at least one decision window; at least one state machine to receive the signals and to detect a modality of the video sequence in accordance with the signals; where the first difference signal indicates relative spatial movement between a current field (CF) and a previous previous field (PPF); and where the second difference signal indicates a motion amount between adjacent fields.
 2. The system of claim 1, where the modality corresponds with an embedded film source in the video sequence.
 3. The system of claim 2, where the at least one state machine ignores redundant fields and recovers the embedded film source by meshing original film fields.
 4. The system of claim 1, where the modality does not correspond with an embedded film source in the video sequence.
 5. The system of claim 4, where the at least one state machine deinterlaces the video sequence using a predetermined deinterlacing algorithm.
 6. The system of claim 1, where the modality corresponds with a pattern in the video sequence.
 7. The system of claim 6, where the at least one state machine discerns differences between a 3:2 pattern, a 2:2 pattern, and a true video mode pattern.
 8. The system of claim 7, where the at least one state machine discerns differences between an N:M pattern and the true video mode pattern.
 9. The system of claim 8, where the at least one state machine includes means for detecting periodic peak values that correspond to the N:M pattern, and establishing a pattern lock responsive to the peak values.
 10. The system of claim 9, where if the at least one state machine detects more than one pattern, a single pattern is selected according to a predetermined priority.
 11. The system of claim 1, where the at least one state machine detects a substantially static pattern in a portion of the video sequence.
 12. The system of claim 11, where the static pattern is a subtitle.
 13. The system of claim 11, where the video sequence contains both the static pattern and an embedded film source, and the at least one state machine discerns a presence of the embedded film source notwithstanding a presence of the static pattern.
 14. The system of claim 13, where the static pattern is detected by examining a plurality of rows of pixels in a field of the video sequence and determining if a predetermined number of high-low transitions between pixels in a row occurs for a predetermined number of rows.
 15. The system of claim 14, where a first field is examined to detect entry of the static pattern and a second field is examined to detect departure of the static pattern.
 16. The system of claim 15, where the first field is a current field and the second field is a previous field.
 17. The system of claim 1, comprising a scene change signal to indicate whether or not a scene change has occurred in the video sequence.
 18. A method comprising: defining at least one region of interest in a video sequence; generating a first difference signal to indicate movement between a current field (CF) and a previous previous field (PPF) and a second difference signal to indicate movement between adjacent fields responsive to the at least one region of interest in the video sequence; detecting a modality of the video sequence in accordance with the signals; and modifying the video sequence responsive to the modality.
 19. The method of claim 18, where detecting includes detecting an embedded film source in the video sequence.
 20. The method of claim 19, where modifying includes ignoring redundant fields and recovering the embedded film source by meshing original film fields.
 21. The method of claim 18, where detecting includes detecting a true video source in the video sequence.
 22. The method of claim 21, where modifying includes deinterlacing the video sequence using a predetermined deinterlacing algorithm.
 23. The method of claim 18, where detecting includes detecting the modality corresponding with a pattern in the video sequence.
 24. The method of claim 23, where detecting includes discerning differences between a 3:2 pattern, a 2:2 pattern, and a true video mode pattern.
 25. The method of claim 24, where detecting includes discerning differences between an N:M pattern and a true video mode pattern by detecting periodic peak values that correspond to the N:M pattern, and establishing a pattern lock responsive to the peak values.
 26. The method of claim 25, where if more than one pattern is detected, a single pattern is selected according to a predetermined priority.
 27. The method of claim 18, where detecting includes detecting a substantially static pattern in a portion of the video sequence.
 28. The method of claim 27, where detecting includes detecting a subtitle.
 29. The method of claim 27, where detecting includes discerning a presence of an embedded film source notwithstanding a presence of the static pattern.
 30. The method of claim 29, where the detecting includes examining a plurality of rows of pixels in a field of the video sequence and determining if a predetermined number of high-low transitions between pixels in a row occurs for a predetermined number of rows.
 31. The method of claim 30, where the detecting includes examining a first field to detect entry of the static pattern and examining a second field to detect departure of the static pattern.
 32. The method of claim 18, where the detecting includes detecting whether or not a scene change has occurred in the video sequence.
 33. A system comprising: means for defining at least one region of interest in a video sequence; means for generating a first difference signal to indicate movement between current and previous fields and a second difference signal to indicate movement between adjacent fields responsive to the at least one region of interest in the video sequence; means for detecting a modality of the video sequence in accordance with the signals; and means for modifying the video sequence responsive to the modality. 